package jmind.asteroidea.core;

import jmind.asteroidea.core.reducer.Reducer;

/**
 * description:
 *
 * @author weibo.xie
 * @date:2022/7/7 下午3:29
 */
public class AsteroideaContextHolder {

    public static ThreadLocal<AsteroideaContext> localContext = new ThreadLocal<>();

    public static void hold(Class<? extends Reducer> reducerClass,String... tags) {
        AsteroideaContext contextDO=new AsteroideaContext();
        contextDO.setTags(tags);
        contextDO.setReducerClass(reducerClass);
        localContext.set(contextDO);
    }

    public static AsteroideaContext getContext() {
        return  localContext.get();
    }

    public static void clear() {
        localContext.remove();
    }


}
